//
//  AddAddressViewController.m
//  跨界收
//
//  Created by Allen on 2018/11/6.
//  Copyright © 2018年 gztx. All rights reserved.
//

#import "AddAddressViewController.h"
#import "YKPickerManager.h"

@interface AddAddressViewController ()
@property (weak, nonatomic) IBOutlet UIView *nameView;
@property (weak, nonatomic) IBOutlet UILabel *bigAddressLabel;
@property (weak, nonatomic) IBOutlet UITextField *detailAddressTextField;

@end

@implementation AddAddressViewController
- (IBAction)click:(id)sender {
    NSString *address = [NSString stringWithFormat:@"%@%@",self.bigAddressLabel.text,self.detailAddressTextField.text];
    if (self.addressBlock) {
        self.addressBlock(address);
    }
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"店铺详细地址";
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
    [self.nameView addGestureRecognizer:tap];
    // Do any additional setup after loading the view from its nib.
}
- (void)tap:(UITapGestureRecognizer *)tap
{
    WeakSelf;
    [[YKPickerManager shareManager] showAddressPickerView:[UIColor redColor] defaultAddress:@"北京" commitBlock:^(NSString *address, NSString *zipcode) {
        weakSelf.bigAddressLabel.text = address;
    } cancelBlock:^{
        
    }];
}
@end
